<?php
session_start();
if(isset($_SESSION['admin_id'])) {
    include('../../include/dbFunctions.php');
    $_SESSION['mes']="";
//Innitialization of variable
    $table = 'contact_school';
    $school_id= $_SESSION['school_id'];
//Retrieve data from POST

    $contact_name = htmlspecialchars($_POST['contact_name']);
    $contact_email = htmlspecialchars($_POST['contact_email']);
    $contact_salutation = htmlspecialchars($_POST['contact_salutation']);
    $contact_designation = htmlspecialchars($_POST['contact_designation']);
    $office_number = htmlspecialchars($_POST['office_number']);
    $mobile_number = htmlspecialchars($_POST['mobile_number']);
    $contact_password = SHA1($_POST['contact_password']);
    $contact_status="active";
    
//Add data to database
    $sQuery = 'INSERT INTO contact_school(contact_name,contact_email,contact_salutation,contact_designation,office_number,mobile_number,school_id,contact_password,contact_status)
VALUES ("'.$contact_name.'","'.$contact_email.'","'.$contact_salutation.'","'.$contact_designation.'","'.$office_number.'","'.$mobile_number.'","'.$school_id.'","'.$contact_password.'","'.$contact_status.'")';
    $sResult = executeQuery($sQuery);
    if ($sResult!=0) {
        $_SESSION['mes'] = "Your record has been added successfully.";
    } else {
        $_SESSION['mes']= "Error! Please try again";
    }$link = "../schoolView.php?id=$school_id";
    header("Location: $link ");
    
}else {
    header("Location: ../../include/login.html");
}
?>